<template>
	<view>
		<view class="logo">
			<!-- <image class="bg" src="/static/my_bg.png"></image> -->
			<view class="img"> 
				<image :src="myconfig.logo" mode="widthFix"></image>
				<!-- <view class="text-center uni-h3 text-bold">{{myconfig.name}}</view> -->
			</view>
		</view>
		<!-- 账号密码输入框 -->
		<view class="flex">
			<view class="flex-sub padding-sm margin-xs radius" style="text-align: center;">
				<text>Android</text>
				<canvas canvas-id="qrcode" style="width: 150px;height: 150px;margin: 0 auto;" />
				<button class="cu-btn round margin-top bg-orange" @tap="noto(andorid)">点击下载</button>
			</view>
			<view class="flex-sub padding-sm margin-xs radius" style="text-align: center;">
				<text>IOS</text>
				<canvas canvas-id="qrcode2" style="width: 150px;height: 150px;margin: 0 auto;" />
				<button class="cu-btn round margin-top bg-orange"  @tap="noto(ios)">点击下载</button> 
			</view>
		</view>

	</view>
</template>

<script>
	import {
		mapState,
		mapActions
	} from 'vuex';
	import uQRCode from '@/common/uqrcode.js'
	export default {
		data() {
			return {

			}
		},
		computed: {
			...mapState({
				myconfig: state => state.user.myconfig
			}),
			andorid() {
				return this.myconfig.android
			},
			ios() {
				return this.myconfig.IOS
			}
		},
		onLoad(option) {
			this.myConfig().catch(e => {});
			this.make()
		},
		methods: {
			...mapActions(['myConfig']),
			make() {
				uQRCode.make({
					canvasId: 'qrcode',
					componentInstance: this,
					text: this.andorid,
					size: 150,
					margin: 10,
					backgroundColor: '#ffffff',
					foregroundColor: '#000000',
					fileType: 'jpg',
					correctLevel: uQRCode.defaults.correctLevel,
					// success: res => {
					// 	console.log(res)
					// }
				})
				uQRCode.make({
					canvasId: 'qrcode2',
					componentInstance: this,
					text: this.ios,
					size: 150,
					margin: 10,
					backgroundColor: '#ffffff',
					foregroundColor: '#000000',
					fileType: 'jpg',
					correctLevel: uQRCode.defaults.correctLevel,
					// success: res => {
					// 	console.log(res)
					// }
				})
			},
			noto(url){
				uni.navigateTo({
					url: '/pages/webview/webview?url=' + encodeURIComponent(url)
				})
			}

		},

	}
</script>

<style lang="scss">
	@import "../../static/css/login.scss";
</style>
